﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using KerriganDataContract.Customer;
using KerriganDataContract.Person;

namespace KerriganForum
{
    public partial class RegisterPage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }


        protected void Button1_Click(object sender, EventArgs e)
        {

            using (ServiceProxy Srv = new ServiceProxy())
            {
                CustomerDC bo = new CustomerDC();
                bo.Person = new PersonDC();
                bo.Person.NickName = TextBoxLogin.Text;
                bo.Person.Email = TextBoxEmail.Text;
                bo.Person.LastName = TextBoxLN.Text;
                bo.Person.FirstName = TextBoxFN.Text;
                bo.Person.City = TextBoxCity.Text;
                bo.Person.Birthday = DateTime.Parse(this.TextBoxBirth.Text);

                bo.Person.Adress = TextBoxAdress.Text;
                bo.Person.Password = TextBoxPassword.Text;
                bo.permisa = CheckBoxPA.Checked;
                bo.permisb = CheckBoxPB.Checked;
                bo.bsr = CheckBoxBsr.Checked;
                bo.Person.PostCode = TextBoxPC.Text;
                bo.Person.PhoneNumber = TextBoxPN.Text;
                bo.dateCode = DateTime.Parse(this.TextBoxCode.Text);

                Srv.Service.AddCustomer(bo);
            }

                Response.Redirect("~/Home.aspx");
        }
    }
}